import loading from "../shared/libs/loading"
import MedicineBoxOutlined from "@ant-design/icons/lib/icons/MedicineBoxOutlined"
import React from "react"
import TeamOutlined from "@ant-design/icons/lib/icons/TeamOutlined"
import FieldTimeOutlined from "@ant-design/icons/lib/icons/FieldTimeOutlined"
import SettingOutlined from "@ant-design/icons/lib/icons/SettingOutlined"


const AccountAdmin = loading(() => import("./account/Account"))
const AccountSalesManager = loading(() => import("./account/SalesManager"))
const AccountSalesman = loading(() => import("./account/Salesman"))
const Product = loading(() => import("./product/index"))
const ProductCopy = loading(() => import("./product/cardList"))
const Template = loading(() => import("./template/index"))
const Commission = loading(() => import("./commission/commission"))
const Settings = loading(() => import("./settings/index"));
const OperationLogger = loading(() => import("./logger/operation"));
const LoginLogger = loading(() => import("./logger/login"))



const product = () => ({
	//如果未配置多语言，则使用label
	label: "项目",
	//用于key和多语言
	key: "product",
	code:'product',
	icon: <MedicineBoxOutlined/>,
	className: undefined,
	// component: Product,
	component: ProductCopy
})

const account = () => ({
	label: "帐号",
	//用于key和多语言
	key: "account",
	code: 'account',
	icon: <TeamOutlined/>,
	className: undefined,
	children: [{
		label: "管理员",
		key: "admin",
		code: "admin",
		component: AccountAdmin,
	}, {
		label: "业务主管",
		key: "salesman_manager",
		code: "salesman_manager",
		component: AccountSalesManager,
	}, {
		label: "业务员",
		key: "salesman",
		code: "salesman",
		component: AccountSalesman,
	},]
})


const logs = () => ({
	label: "日志",
	//用于key和多语言
	key: "log",
	code: 'log',
	icon: <FieldTimeOutlined/>,
	className: undefined,
	children: [{
		label: "登录日志",
		key: "login",
		code: "log:login",
		component: LoginLogger,
	},
		{
			label: "操作日志",
			key: "operation",
			code: "log:operation",
			component: OperationLogger,
		},]
})

const setting = () => ({
	label: "设置",
	//用于key和多语言
	key: "setting",
	code: 'setting',
	icon: <SettingOutlined/>,
	className: undefined,
	children: [{
		label: "系统配置",
		key: "formula",
		code: "setting:formula",
		component: Settings,
	}, {
		label: "提成率",
		key: "commission",
		code: "setting:commission",
		component: Commission,
	}, {
		label: "模板下载",
		key: "template",
		code: "setting:template",
		component: Template,
	}]
})


const menus = () => {
	return [
		product(),
		account(),
		logs(),
		setting()

	]
}

const App = loading(() => import("./app"))

export default menus
